package collection_2504015;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class iterator1 {
    public static void main(String[] args) {
        List<String> list = Arrays.asList("a", "b", "c","d","e","f","g");
        Iterator<String> iterator = list.iterator();

        while (iterator.hasNext()) {
            String s = iterator.next();
            System.out.println(s);
            iterator.remove();

        }

        System.out.println(list);

    }
}
